package ru.nsu.fit.ask_joe.user_interface_manager.realization;

import android.os.AsyncTask;
import ru.nsu.fit.ask_joe.MainManager;
import ru.nsu.fit.client.core.response.KernelResponse;

public class KernelResponseProcessor extends AsyncTask<Integer, Void, KernelResponse>
{
    @Override
    protected KernelResponse doInBackground(Integer... params) {
        KernelResponse response = null;
        try {
            //Waiting for response
            do
            {
                response = MainManager.getClientKernel().getResponse(params[0]);
                Thread.sleep(100);
            } while (response == null);
        }
        catch (InterruptedException e)
        {
            MainManager.getLogManager().getLogger().printError(e.getMessage());
        }
        return response;
    }
}
